<?php 
/*
	

 */
	namespace backend\controllers;
	require '../QueryList/vendor/autoload.php';
	use QL\QueryList;
	use Yii;
	use yii\web\Controller;

	use backend\models\Demo;
	class DemoController extends Controller{
		public function actionIndex()
		{
			$model = new Demo();
			// echo 1;die;
			header("content-type:text/html;charset=utf-8");
			// $url = "http://baidu.lecai.com/lottery/draw/list/3";
			$url = "http://baidu.lecai.com/lottery/draw/list/4";
			$arr = array(
				'kr'=>array('td.td1','html'),
				'kq'=>array('td.td2 a','html'),
				'kh'=>array('td.td3 span.ball_1 ','html'),
				);
			$result = QueryList::query($url,$arr,'table#draw_list tr')->data;
			array_shift($result);
			// print_r($result);die;
			
			foreach ($result as $k => $v) {
				Yii::$app->db->createCommand()->insert('demo', [  
				    'kr' => $v['kr'],  
				    'kq' => $v['kq'], 
				    'kh' => $v['kh'], 
				    'type' =>'2',
				])->execute();
			}
			
		}




	}
	

 ?>